import os
from openai import OpenAI
from langchain.prompts import PromptTemplate
import os

os.environ["DASHSCOPE_API_KEY"] = 'sk-965dc39b016c49ecbe29de180f4db2b6'
from langchain_community.llms import Tongyi
# from langchain.chains import
from langchain.prompts import PromptTemplate

llm = Tongyi(temperature=0.3)

template = "请帮我生成{language}打印'helloworld'的示例代码"
prompt_tbl = PromptTemplate.from_template(template=template)
for language in ['Python','Java','C++']:
    prompt = prompt_tbl.format(language = language)
    print(f'{"=" * 10} {language} {"=" * 10}')
    print(llm(prompt))
